package com.sgcc.sx.pmos.common.dialog;

import android.content.Context;

import android.widget.LinearLayout;

import com.lxj.xpopup.core.CenterPopupView;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.sx.pmos.common.view.LineChartView;
import com.sgcc.sx.pmos.common.view.LineMarkerView;
import com.sgcc.sx.pmos.common.view.TwoLineChartView;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ChaoAJ
 * @describe 折线图弹窗
 * @time 2022/8/29 14:10
 */
public class LineChartDialog extends CenterPopupView {

    private List<String> mList;
    private List<String> mList2;

    public LineChartDialog(Context context, List<String> list) {
        super(context);
        mList = list;
    }

    public LineChartDialog(Context context, List<String> list1, List<String> list2) {
        super(context);
        mList = list1;
        mList2 = list2;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_line_chart_layout;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        findViewById(R.id.imgLineChartClose).setOnClickListener(view -> dismiss());
        LinearLayout llLineChart = findViewById(R.id.llLineChart);
        LinearLayout llLegend = findViewById(R.id.llLegend);
        if (null != mList && mList.size() > 0 && null != mList2 && mList2.size() > 0) {
            llLegend.setVisibility(VISIBLE);
            llLineChart.addView(new TwoLineChartView(getContext(), mList, mList2));
        } else if (null != mList && mList.size() > 0) {
            llLineChart.addView(new LineChartView(getContext(), mList, false, true));
        }
    }

    @Override
    protected void onShow() {
        super.onShow();
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
    }

}